package com.fz.dao;

import com.fz.entity.Book;
import com.fz.mapper.BookMapper;
import lombok.Data;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.List;
import java.util.Map;

/**
 * Created by webrx on 2017-09-11.
 */
@Service("bookDAO") @Data
public class BookDAO implements BookMapper{
    @Autowired
    private BookMapper dao;

    //@Autowired
    //private SqlSession session;

    public void mysave(String name){
        //System.out.println(this.session.getConnection());
        //Connection conn = this.session.getConnection();
        //PreparedStatement pst = conn.prepareStatement("insert into")
        //conn.close();
    }

    public Book queryById(int id){
        return dao.queryById(id);
    }

    public List<Book> queryAll(){
        return dao.queryAll();
    }

    public int deleteById(int id) {
        return dao.deleteById(id);
    }

    public int save(Book book) {
        return 0;
    }

    public List<Map<String, Object>> query() {
        return null;
    }
}
